﻿using System.Collections.Generic;
using Engine;
using Game;


public class 时空裂缝 : SubsystemBlockBehavior, IUpdateable
{
    public SubsystemTime m_subsystemTime;

    public SubsystemGameInfo m_subsystemGameInfo;

    public Dictionary<Point3, int> m_toUpdate = new Dictionary<Point3, int>();

    public Game.Random m_random = new Game.Random();

    public string FS;

    public override int[] HandledBlocks => new int[1]
    {
            597
    };

    public UpdateOrder UpdateOrder => UpdateOrder.Default;

    public override void OnCollide(CellFace cellFace, float velocity, ComponentBody componentBody)
    {
        ComponentPlayer componentPlayer = componentBody.Entity.FindComponent<ComponentPlayer>();
        if (componentBody != componentPlayer.ComponentBody)
        {
            componentBody.Entity.FindComponent<ComponentCreature>()?.ComponentHealth.Injure(0.1f * MathUtils.Abs(velocity), null, ignoreInvulnerability: false, "Spiked by cactus");
        }

        if (componentPlayer != null)
        {

            if (componentPlayer.PlayerData.Level > 49f)
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("传送中...请不要动", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                componentPlayer.ComponentBody.Position = new Vector3(100000, 256, 256);

            }


            if (componentPlayer.PlayerData.Level > 20f)
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("传送中...请不要动", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                componentPlayer.ComponentBody.Position = new Vector3(10000, 256, 256);

            }
            else
            {
                componentPlayer.ComponentGui.DisplaySmallMessage("等级不足20级", new Color(255, 0, 0), blinking: true, playNotificationSound: false);
                componentBody.Entity.FindComponent<ComponentCreature>()?.ComponentHealth.Injure(0.1f * MathUtils.Abs(velocity), null, ignoreInvulnerability: false, "被时空裂缝撕裂");
            }
        }
    }

    public void Update(float dt)
    {
    }
}
